package com.lots.controller.user;

import com.lots.domain.entity.Activity;
import com.lots.utils.Result;
import com.lots.service.ActivityService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/activity")
@Tag(name = "活动相关接口")
public class ActivityController {
    @Autowired
    private ActivityService activityService;
    /**
     * 查询活动
     */
    @GetMapping()
    @Operation(summary = "查询活动")
    public Result getDish(){
        List<Activity> activityList = activityService.getActivityList();
        return Result.success(activityList);
    }
    /**
     * 是预约/取消预约过活动
     */
    @PostMapping("/isReserved/{activityId}")
    @Operation(summary = "用户预约/取消预约")
    public Result isReserved(@PathVariable Long activityId){
        boolean isReserved = activityService.isReserved(activityId);
        return Result.success(isReserved);
    }
    /**
     * 查询用户预约状态
     */
    @GetMapping("/reservedStatus/{activityId}")
    @Operation(summary = "查询用户是否预约过该活动")
    public Result reservedStatus(@PathVariable Long activityId){
        boolean isReserved = activityService.reservedStatus(activityId);
        return Result.success(isReserved);
    }



}
